<template>
  <div>
    <link rel="stylesheet" href="./static/Eleditor-master/layout/base.css"/>
    <section id="article-body"></section>
  </div>
</template>
<script>
  import scriptjs from 'scriptjs'

  export default {
    name: 'mobileEditor',
    data() {
      return {}
    },
    methods: {
      fetchScript: function (url) {
        return new Promise((resolve) => {
          scriptjs(url, () => {
            resolve()
          })
        })
      },
      init: function() {
        (async () => {
          await this.fetchScript('./static/jquery.min.js')
          await this.fetchScript('./static/Eleditor-master/webuploader.min.js')
          await this.fetchScript('./static/Eleditor-master/Eleditor.js')

        this.$nextTick(() => {
          var artEditor = new window.Eleditor({
            el: '#article-body',
            upload: {
              server: '/upload.php',
              fileSizeLimit: 2
            }
          });
        })
        })()
      }
    },
    mounted: function () {
      let vm = this
      vm.init()
    }
  }

</script>
<style>
</style>
